package com.qf.blog.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.blog.system.entity.SystemUserEntity;
import com.qf.blog.system.mapper.SystemUserMapper;
import com.qf.blog.system.service.ISystemUserService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Java2207
 * @since 2022-12-22
 */
@Service
public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUserEntity> implements ISystemUserService {

    @Override
    public SystemUserEntity getByUsername(String username) {
        QueryWrapper<SystemUserEntity> queryWrapper = new QueryWrapper();
        queryWrapper.eq("username", username); //相当于 where usenrame = ?
        return baseMapper.selectOne(queryWrapper); // 返回只有一条记录
    }
}
